/**
 * 针对仓库中count来设计的reducer
 * @param {} state 
 * @param {*} action 
 * @returns 
 */
import {INCREMENT,DECREMENT} from "../constanst"
export default function reducer(state={count:0},action){
    console.log(action);
    switch(action.type){
        case INCREMENT:
            state.count += action.payload
            //React一定检测state这个对象地址是否由变化
            return {...state}
        case DECREMENT:
            state.count -= action.payload
            return {...state}
        default:
            return state
    }
}

